package com.yyx.app1.DiagnosticTools_function.Control.ViewPager.ViewPagerItemControl.firstControl;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.HashMap;
import java.util.List;

/**
 * Created by yuexing on 2015/10/14.
 */
public class First_ViewPager_ListView_Apater extends BaseAdapter {
    private Context context;
    private String[] data;
    private int[] drawables;
    private int[] backgroud;

    public First_ViewPager_ListView_Apater(Context context) {
        this.context = context;
    }

    public void findAll(String[] data,int[] drawables,int[] backgroud)
    {
        this.data = data;
        this.drawables = drawables;
        this.backgroud = backgroud;
    }

    @Override
    public int getCount() {
        return data.length;
    }

    @Override
    public Object getItem(int position) {
        return data[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ItemView_First_ViewPager_ListView it;
        if (convertView==null)
        {
            it = ItemView_First_ViewPager_ListView_.build(context);
        }
        else
        {
            it = (ItemView_First_ViewPager_ListView)convertView;
        }
        it.bind(data[position],drawables[position],backgroud[position]);
        return it;
    }
}
